package com.imooc.springbootlearn.controller;

import com.imooc.springbootlearn.entity.Student;
import com.imooc.springbootlearn.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StudentController {
    /**
     * 学生信息服务
     */
    @Autowired
    StudentService studentService;
    /**
     * 学生信息
     * @param num 学号
     * @return 学号
     */
    @GetMapping("/student")
    public String student(@RequestParam Integer num) {
        Student student = studentService.findStudent(num);
        return student.toString();
    }
}
